<?php
class PNSubcategoryModelArray extends PNObjectExArray {
  function PNSubcategoryModelArray($init=null, $where='')
  {
    $this->PNObject();

    $this->_objType       = 'innoforum_subcategory_model';
    $this->_objField      = 'id';
    $this->_objPath       = 'form';

    $this->_objJoin[]     = array ( 'join_table'  =>  'innoforum_model',
                            'join_field'          =>  array('id', 'name'),
                            'object_field_name'   =>  array('model_id', 'model_name'),
                            'compare_field_table' =>  'model_id',
                            'compare_field_join'  =>  'id');

    $this->_init($init, $where);

  }

  function genSort(){
    return " ORDER BY mod_name ASC";
  }

  function genFilter(){
    $subcategory_id  = FormUtil::getPassedValue ('subcategory_id', false);

    $wheres = array();

    //filter by selector
    if ($subcategory_id && intval($subcategory_id))
      $wheres[] = "smod_subcategory_id ='$subcategory_id'";
    var_dump($wheres); exit;
    return implode(' AND ', $wheres) ;
  }
}